package com.app.designpatternslearn.behavior.observerpattern.code

class Subject {

    private val observers = mutableListOf<Observer>()

    fun addObserver(observer: Observer) {
        observers.add(observer)
    }

    fun removeObserver(observer: Observer) {
        observers.remove(observer)
    }

    fun notifyAllObservers() {
        for (item in observers) {
            item.update()
        }
    }
}